/*
 * DataTypes.h
 *
 * Created: 2012-05-28 22:49:29
 *  Author: Sebastian_2
 */ 


#ifndef DATATYPES_H_
#define DATATYPES_H_

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stddef.h>

// general
enum Status {
	TOUCHSCREEN_IDLE = 1 << 0,
	TOUCHSCREEN_READ = 1 << 1,
	PLAYER_PLAY		 = 1 << 2,
	PLAYER_PAUSE	 = 1 << 3,
	PLAYER_STOP		 = 1 << 4,
	PLAYER_REPEAT	 = 1 << 5,
	PLAYER_SSELECTED = 1 << 6, // song selected
};

enum Gesture {
	GESTURE_UP		= 1 << 0,
	GESTURE_DOWN	= 1 << 1,
	GESTURE_LEFT	= 1 << 2,
	GESTURE_RIGHT	= 1 << 3,
	GESTURE_POINT	= 1 << 4, // not really a gesture, but it's useful
	GESTURE_NONE	= 1 << 5
};

// point
typedef struct {
	uint16_t x;
	uint16_t y;
} point;

point IncX(point *p, uint8_t val);
point IncY(point *p, uint8_t val);
point DecX(point *p, uint8_t val);
point DecY(point *p, uint8_t val);

// RTC
typedef struct {
	uint8_t seconds;
	uint8_t minutes;
	uint8_t hours;
	uint8_t day;
	uint8_t date;
	uint8_t month;
	uint8_t year;
} RTCt;

// Temperature
typedef struct {
	int8_t integer;
	uint16_t fraction;
} temperature;

// font
typedef struct PROGMEM {
	const uint8_t widthBits;					// width, in bits (or pixels), of the character
	const uint16_t offset;					// offset of the character's bitmap, in bytes, into the the FONT_INFO's data array
} FONT_CHAR_INFO;	

// Describes a single font
typedef struct PROGMEM {
	const uint8_t 			heightPixels;	// height, in pixels, of the font's characters
	const uint8_t 			startChar;		// the first character in the font (e.g. in charInfo and data)
	const uint16_t 			endChar;		// the last character in the font
	const uint8_t			spacePixels;	// number of pixels that a space character takes up
	const FONT_CHAR_INFO*	charInfo;		// pointer to array of char information
	const uint8_t*			data;			// pointer to generated array of character visual representation
} FONT_INFO;	

// VS1003
typedef struct {
	char artistName[30];
	char songName[30];
	uint32_t tagLenth;
} AudioFile_t;

// images
typedef struct {
	uint16_t magic;
	uint16_t width;
	uint16_t height;
	uint32_t pixels;
} RGB565Header;

// menu
enum Keyboard_Display {
	UPPERCASE,
	LOWERCASE,
	NUMBERS	
};

// everything else
uint8_t IsInRange(point touch, point ItemStart, point ItemEnd); // TODO: move to ADS



#endif /* DATATYPES_H_ */